<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/jquery-weui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/index.css" />
    <link rel="stylesheet" type="text/css" href="../../css/order.css" />
    <title>订单详情</title>
    <script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/baseConfig.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
    <!--<div id="header">
			<div class="header-title" style="position: fixed;top: 0;">
				<img src="../../img/left.png" class="left" />
				<span>订单详情</span>
			</div>
		</div>-->
    <div class="orderInfor-warp" style="margin-top: 0;">
        <!--基本信息-->
        <div class="baseInfor">
            <div class="identity-type">
                <span>基本信息</span>
            </div>
            <div class="essen_list essen_after">

            </div>
            <div class="essen_list essen_paytype">

            </div>
        </div>
        <!--物料列表-->
        <div class="materInfor">
            <div class="identity-type material-title">
                <span>物料列表</span>
            </div>
            <div class="material-list">
                <ul class="material_list">

                </ul>
                <ol class="material_photo_list">

                </ol>
            </div>
        </div>
        <!--合同扫描件-->
        <div class="contractInfor">
            <div class="identity-type">
                <span>合同扫描件</span>
            </div>
            <div class="contract-scans">
                <p class="quotation">
                    <span>报价单</span>
                    <img src="../../img/right.png" />
                </p>
                <p class="alreadySigned">
                    <span>已签章合同</span>
                    <img src="../../img/right.png" />
                </p>
                <p class="originalContract">
                    <span>合同原件</span>
                    <img src="../../img/right.png" />
                </p>
            </div>
        </div>

        <!--过磅入库信息-->
        <div class="ponderationInfor">
            <div class="identity-type">
                <span>过磅入库信息</span>
                <i class="transInfor">运输车信息</i>
            </div>
            <div class="ponderation-info">
                <div class="ponderation-info-warp info-warp1">

                </div>

                <div class="contract-scans">
                    <p class="outPonder">
                        <span>出库磅单</span>
                        <img src="../../img/right.png" />
                    </p>
                    <p class="initPonder">
                        <span>收货磅单</span>
                        <img src="../../img/right.png" />
                    </p>
                    <p class="entryInfor">
                        <span>确认运输完毕</span>
                        <img src="../../img/right.png" />
                    </p>
                    <p class="receipt">
                        <span>收货单</span>
                        <img src="../../img/right.png" />
                    </p>
                </div>
            </div>
        </div>

        <!--支付信息-->
        <div class="payInfor">
            <div class="identity-type">
                <span>支付信息</span>
                <i class="ticketInfor">开票信息</i>
            </div>
            <div class="ponderation-info">
                <div class="ponderation-info-warp info-warp2">

                </div>

                <div class="contract-scans">
                    <!--<p class="express">
							<span>发票快递单</span>
							<img src="../../img/right.png" />
						</p>-->
                    <p class="banks">
                        <span>银行回单</span>
                        <img src="../../img/right.png" />
                    </p>
                </div>
            </div>
        </div>

    </div>
</body>
<script type="text/javascript">
    $(document).ready(function() {
        baseConfig.historyBack();
        $.showLoading("加载中...");
        var id = baseConfig.GetQueryString("orderid");

        function showNull(str) {
            if (!str || str == null) {
                return 0
            } else {
                return str
            }
        }

        function showNull2(str) {
            if (!str || str == null) {
                return ""
            } else {
                return str
            }
        }
        $.ajax({
            type: "get",
            url: baseConfig.localHttp2 + "/api/order/getFgOrderDetail",
            async: true,
            data: {
                orderId: id
            },
            success: function(data) {
                //					console.log(data)
                var content = data.content
                var orderMaterialList = content.orderMaterialList
                var $li = ""
                $.hideLoading();
                if (data.code == 100) {
                	if(content.isHanshui==20){
                		$(".ticketInfor").hide()
                	}else{
                		$(".ticketInfor").show()
                	}
                    if (!content.exceptionRemarks) {
                        content.exceptionRemarks = ""
                    }
                    if (!content.remarks) {
                        content.remarks = ""
                    }
                    if (!content.tranTypeLabel) {
                        content.tranTypeLabel = ""
                    }
                    $(".essen_after").html(
                        "<p><span>订单编号</span><b>" + content.orderNo + "</b></p><p><span>订单状态</span><b style='color:" + baseConfig.colorCode(content.fgOrderStatus) + "'>" + content.fgOrderStatusLabel + "</b></p>" +
                        "<p>异常说明</p><p class='last_p'>" + content.exceptionRemarks + "</p>"
                    )
                    $(".essen_paytype").html(
                        "<p><span>支付方式</span><b>" + content.payTypeLabel + "</b></p><p><span>运输方式</span><b> " + content.tranTypeLabel + " </b></p><p >备注 </p> <p class = 'last_p' >" + content.remarks + "</p>"
                    )
                    if (orderMaterialList == null) {
                        $(".material-title").hide()
                    } else {
                        for (var i = 0; i < orderMaterialList.length; i++) {
                            $li += "<li><p><span>" + orderMaterialList[i].materialName + "</span><imgsrc='../../img/right.png' /></p><p><span>物料重量</span><b>" + orderMaterialList[i].weight + "<em>吨</em></b></p><p><span>物料单价</span><b>" + orderMaterialList[i].unitPrice + "<em>元/吨</em></b></p><p><span>含杂比例</span><b>" + orderMaterialList[i].zazhiPercent + "<em>%</em></b></p></li>"
                        }
                        $(".material_list").append($li)
                    }
                    $(".info-warp1").html(
                        "<p><span>已过磅数量</span><b>" + showNull(content.weighCount) + "<em>吨</em></b></p><p><span>未过磅数量</span><b>" + showNull(content.noWeighCount) + "<em>吨</em></b></p><p><span>现场扣杂比例</span><b>" + showNull(content.realKouzaPercent) + "<em>%</em></b></p><p><span>实际入库数量</span><b>" + showNull(content.realEnterCount).toFixed(3) + "<em>吨</em></b></p><p><span>实际成交金额</span><b>" + showNull(content.finishTotalPrice) + "<em>元</em></b></p><p><span>实际入库时间</span><b>" + showNull2(content.enterWareTimeStr) + "</b></p>"
                    )
                    $(".info-warp2").html(
                        "<p><span>应支付金额</span><b>" + showNull(content.needPayMoney) + "<em>元</em></b></p><p><span>已支付金额</span><b>" + showNull(content.hadPayMoney) + "<em>元</em></b></p><p><span>未支付金额</span><b>" + showNull(content.noPayMoney) + "<em>元</em></b></p><p><span>支付完成时间</span><b>" + showNull2(content.payTimeStr) + "</b></p>"
                    )
                    var status = content.fgOrderStatus
                        //判断状态
                    if (status == 100 || status == 60 || status == 110 || status == 70) {
                        $(".baseInfor").show();
                        $(".materInfor").show();
                        $(".contractInfor").show();
                        $(".ponderationInfor").show();
                        $(".payInfor").show();
                    }
                    if (status == 20) {
                        $(".baseInfor").show();
                        $(".materInfor").show();
                        $(".contractInfor").show();
                        $(".ponderationInfor").hide();
                        $(".payInfor").hide();
                    }
                    if (status == 40) {
                        $(".baseInfor").show();
                        $(".materInfor").show();
                        $(".contractInfor").show();
                        $(".ponderationInfor").show();
                        $(".payInfor").hide();
                    }
                    if (status == 0 || status == 10) {
                        $(".baseInfor").show();
                        $(".materInfor").show();
                        $(".contractInfor").hide();
                        $(".ponderationInfor").hide();
                        $(".payInfor").hide();
                    }

                    //报价单跳转
                    $(".quotation").on("click", function() {
                            location.href = "../mine/quotation.html?orderNo=" + content.orderNo + "&status=1"
                        })
                        //已签章合同跳转
                    $(".alreadySigned").on("click", function() {
                        location.href = "../mine/signingContract.html?orderNo=" + content.orderNo + "&status=1"
                    })

                    //合同原件跳转
                    $(".originalContract").on("click", function() {
                            $.ajax({
                                type: "get",
                                url: baseConfig.localHttp + "weChatApi/fgclient/getOriginFile",
                                async: true,
                                data: {
                                    orderNo: data.content.orderNo
                                },
                                success: function(data) {
                                    if (data.code == 100) {
                                        window.location.href = baseConfig.imglocalHttp + data.content
                                    } else {
                                        $.toptip(data.content, 1200, 'error');
                                    }
                                }
                            });
                        })
                        //出库过磅单
                    $(".outPonder").on("click", function() {
                            location.href = "orderPoundlist.html?orderNo=" + content.orderNo + "&status=1"
                        })
                        //入库过磅单     //去过磅列表
                    $(".initPonder").on("click", function() {
                            location.href = "../mine/ponderationList.html?orderNo=" + content.orderNo + "&status=1"
                        })
                        //运输完毕咨询
                    $(".entryInfor").on("click", function() {
                            location.href = "../mine/transportCompletion.html?orderNo=" + content.orderNo + "&status=1"
                        })
                        //入库单
                    $(".receipt").on("click", function() {
                            location.href = "../mine/confirmwarehouseReceipt.html?orderNo=" + content.orderNo + "&status=1"
                        })
                        //运输车信息，跳运输车列表
                    $(".transInfor").on("click", function() {
                            location.href = "orderTransport.html?orderNo=" + content.orderNo + "&status=1"
                        })
                        //开票信息
                    $(".ticketInfor").on("click", function() {
                            location.href = "ticketInformation.html?kaipiaoId=" + content.kaipiaoId + "&status=1"
                        })
                        //发票快递单
                        //						$(".express").on("click", function() {
                        //							location.href = "getDeliver.html?orderNo=" + content.orderNo + "&status=1"
                        //						})
                        //银行回单
                    $(".banks").on("click", function() {
                        location.href = "bankTicket.html?orderNo=" + content.orderNo + "&status=1"
                    })
                } else {
                    $.toptip(data.content, 1200, 'error');
                }
            }
        });
    })
</script>

</html>